package com.bailong.nanny.test;

import com.bailong.nanny.d.UserDao;
import com.bailong.nanny.dao.impl.UserDaoImpl;
import com.bailong.nanny.entity.User;
import com.bailong.nanny.service.LoginService;
import com.bailong.nanny.service.UserService;
import com.bailong.nanny.service.impl.LoginServiceImpl;
import com.bailong.nanny.service.impl.UserServiceImpl;
import com.bailong.nanny.util.JdbcUtils;
import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import sun.security.jgss.LoginConfigImpl;

public class testJdbcUtils {

    @Test
    public void testInsertUser(){
        for(int i =0;i<50;i++){

            User user = new User(i,"test-" + i,"某某人","某某地址","1389887564","");

            JdbcUtils.update("insert into tb_user(username,realname,address,tel,pic)values(?,?,?,?,?)"
            ,user.getUsername(),user.getRealName(),user.getAddress(),user.getTel(),user.getPic());
        }
    }
    @Test
     public void testCount(){
        int count = JdbcUtils.queryCount("select count(*) from tb_user");
         System.out.println("行数：" + count);
     }

    @Test
    public void nannyTest(){
        int count = JdbcUtils.queryCount("select count(*) from tb_user");
        System.out.println("行数：" + count);
    }
    @Test
    public void testLog(){
        ClassPathXmlApplicationContext c = new ClassPathXmlApplicationContext("spring.xml");
        LoginService loginService = (LoginService) c.getBean("login");
//        loginService.LoginDao("admin","123456");
        loginService.LoginDao("admin","123456");
    }

}
